#!/usr/local/bin/perl -w
use strict;
use utf8;
use lib '../lib';

use NG::Gen::App 'NG::Sys::Loop::Daemon';

my $app = new NG::Sys::App(logger => "daemon");

$app->run;

# called after fork
sub on_prepare_loop {
	my ($app) = @_;
}
# called to check possible ener loop
sub on_enter_loop {
	my($app) = @_;
	return  1; # yes, enter to loop
}
# called to check possible do process
sub on_before_process {
	my($app) = @_;
	return 1; # yes, do main process
}
# main process
sub on_process {
	my($app) = @_;
}
# called after sucessful main process
sub on_after_process {
	my($app) = @_;
}
################ overloadeable method ########
#sub on_before_loop {
#	my ($self) = @_;
#	unless($self->SUPER::on_before_loop){
#		# cannot run loop
#		return 0;
#	}
#	# can run loop
#	return 1;
#}
#sub on_init_process {
#	my ($self) = @_;
#	$self->SUPER::on_init_process;
#}
#sub on_done_process {
#	my ($self) = @_;
#	$self->SUPER::on_done_process;
#}
#sub on_leave_loop {
#	my ($self) = @_;
#	if($self->SUPER::on_leave_loop){
#		# need leave loop
#		return 1;
#	}
#	# continue loop
#	return 0;
#}
#sub on_after_loop {
#	my ($self) = @_;
#	# make need action
#	$self->SUPER::on_after_loop;
#}

1;